import type { ExportConfig, PaginationConfig } from "./BaseModels";
import type { SearchConfig } from "./BaseModels";
import type { TableConfig } from "./BaseModels";


export interface Schema {
    layout: any;
    components: Component[];
}

export type Component = {
    id: string;

} & (
    | {
        type: "table";
        config: BaseTableConfig;
    }
    | {
        type: "chart";
        config: BaseChartConfig;
    }
    | {
        type: "pie-chart";
        config: BasePieChartConfig;
    }
)

export interface BaseTableConfig {
    tableConfig: TableConfig;
    paginationConfig: PaginationConfig;
    searchConfig: SearchConfig;
    exportConfig: ExportConfig;
}

export interface BaseChartConfig {
    chartType: string;
    title: string;
    api: Api;
}

export interface BasePieChartConfig {
    chartType: string;
    title: string;
    api: Api;
}   

export interface Api {
    url: string;
    method: string;
    params?: any;
}




